/**
 * @description: 节点
 */

import { defHttp } from '../http'
import type { CommonAPI } from '../schema/all'

/**
 * @description: 节点
 */

/** 获取节点 */
export const getApiNodeApi: CommonAPI<'/api/node', 'get'> = (params) =>
  defHttp.get(`/api/node`, { params })

/** 更新节点 */
export const updateApiNodeApi: CommonAPI<'/api/node', 'put'> = (data) =>
  defHttp.put(`/api/node`, { data })

/** 创建节点 */
export const addApiNodeApi: CommonAPI<'/api/node', 'post'> = (data) =>
  defHttp.post(`/api/node`, { data })

/** 删除节点 */
export const deleteApiNodeApi: CommonAPI<'/api/node', 'delete'> = (data) =>
  defHttp.delete(`/api/node`, { data })

/** 获取级联区域列表 */
export const getApiNodeCascadeRegionListApi: CommonAPI<
  '/api/node/cascade_region_list',
  'get'
> = (params) => defHttp.get(`/api/node/cascade_region_list`, { params })

/** 控制节点 */
export const postApiNodeControlApi: CommonAPI<'/api/node/control', 'post'> = (
  data
) => defHttp.post(`/api/node/control`, { data })

/** 查询节点 */
export const getApiNodeQueryApi: CommonAPI<'/api/node/query', 'get'> = (
  params
) => defHttp.get(`/api/node/query`, { params })

/** 注册节点 */
export const postApiNodeRegisterApi: CommonAPI<'/api/node/register', 'post'> = (
  data
) => defHttp.post(`/api/node/register`, { data })

/** 获取节点简单信息 */
export const getApiNodeSimpleListDetailApi: CommonAPI<
  '/api/node/simple-list',
  'get'
> = (data) => defHttp.get(`/api/node/simple-list`, { data })

/** 获取节点区域树 */
export const getApiNodeTreeWithRegionApi: CommonAPI<
  '/api/node/tree-with-region',
  'get'
> = (params) => defHttp.get(`/api/node/tree-with-region`, { params })

/** 更新节点级联区域 */
export const updateApiNodeUpdateCascadeRegionApi: CommonAPI<
  '/api/node/update_cascade_region',
  'put'
> = (data) => defHttp.put(`/api/node/update_cascade_region`, { data })
